package edu.zqu.collegeField.framework.activiti.service;


import org.activiti.engine.history.HistoricTaskInstance;

import java.util.List;

public class ActivitiHistoryQuery extends ActivitiBase {
    //查询申请记录
    public static List<HistoricTaskInstance> Record(String assignee) {
        List<HistoricTaskInstance> historicTaskInstanceList = historyService.createHistoricTaskInstanceQuery()
                .taskAssignee(assignee)
                .finished()
                .orderByHistoricTaskInstanceStartTime()
                .desc()
                .list();
        for (HistoricTaskInstance historicTaskInstance : historicTaskInstanceList) {
            System.out.println("任务ID:" + historicTaskInstance.getId());
            System.out.println("流程实例ID:" + historicTaskInstance.getProcessInstanceId());
            System.out.println("办理人：" + historicTaskInstance.getAssignee());
            System.out.println("创建时间：" + historicTaskInstance.getCreateTime());
            System.out.println("结束时间：" + historicTaskInstance.getEndTime());
            System.out.println("===========================");
        }
        return historicTaskInstanceList;
    }
}
